package com.retry.task.core.threadlocal;

import com.alibaba.ttl.TransmittableThreadLocal;
import com.retry.task.core.model.AttributeModel;
import jdk.internal.misc.TerminatingThreadLocal;

/**
 * @author gao.gwq
 * @version 1.0
 * @date 2022/10/22  22:48
 * @Description TODO
 */
public class RetryTaskThreadLocal {


    private static final ThreadLocal<AttributeModel> attributeModelThreadLocal
            = new TransmittableThreadLocal<>();
/*    private static final ThreadLocal<AttributeModel> attributeModelThreadLocal
            = new ThreadLocal<>();*/

    public static AttributeModel getAttributeModel() {
        return attributeModelThreadLocal.get();
    }


    public static void setAttributeModelThreadLocal(AttributeModel attributeModel) {
        attributeModelThreadLocal.set(attributeModel);
    }

    public static void removeAttribute() {
        attributeModelThreadLocal.remove();
    }
}